//- Copyright (c) 2016 Lucky Byte, Inc.
extends ../table

block form_items
  .field.thirteen.wide
    .ui.buttons.right.floated
      if page_perms.new
        button.ui.left.icon.labeled.green.button#new(type="button"
          onclick="window.location = '/trctl_t/new'") 新 增
          i.icon.plus
      else
        button.ui.green.button.disabled#new(type="button")
          i.icon.ban
          | 新 增

block thead
  tr
    th.center.aligned
    th.center.aligned 序号
    th.center.aligned 名 称
    th.center.aligned 交易权限
    th.center.aligned 备 注

block tbody
  each record, index in records
    tr
      td.center.aligned.collapsing
        i.icon.caret.right.link.detail.expand
      td.center.aligned.collapsing
        if page_perms.edit || page_perms.disable
          a(href="/trctl_t/edit/#{record.serial}")= record.serial
        else
          a= record.serial
      td.center.aligned.collapsing= record.name
      - var text = ''
      - for (var k in record.trctl.trcodes)
        - text += constant.trctl_codes[k] + "、"
      - text = text.substring(0, text.length - 1)
      if text.length > 60
        td #{text.substring(0, 60)} ...
      else
        td= text
      td= record.notes

    tr.detail(style="display: none;")
      td.right.aligned.warning(colspan="1") 详细信息
      td(colspan="4"
        style="padding-top:0px; padding-bottom:0px; padding-right:1px;")
        include detail
